package com.study.jyg.rxjava2study.activity;

import android.content.res.ColorStateList;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorMatrixColorFilter;
import android.os.Build;
import androidx.core.content.ContextCompat;
import android.widget.ImageView;

import com.study.jyg.rxjava2study.R;
import com.study.jyg.rxjava2study.base.BasicActivity;
import com.study.jyg.rxjava2study.utils.IconUtils;

/**
 * 修改图片颜色
 */
public class IconColourChangeActivity extends BasicActivity {


    @Override
    protected int getLayout() {
        return R.layout.activity_icon_colour_change;
    }

    @Override
    protected void initView() {
        ImageView ivPic1 = findViewById(R.id.ivPic1);
        ImageView ivPic2 = findViewById(R.id.ivPic2);
        ImageView ivPic3 = findViewById(R.id.ivPic3);
        ImageView ivPic4 = findViewById(R.id.ivPic4);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            ivPic1.setImageDrawable(IconUtils.tintDrawable(ContextCompat.getDrawable(mContext, R.mipmap.icon_main_navigationbar_msg), 1.0f, 120f, 90f, 200f));
        }

        ivPic2.setImageBitmap(IconUtils.getAlphaBitmap(IconUtils.FromRidToBitmap1(mContext, R.mipmap.icon_main_navigationbar_msg), ContextCompat.getColor(mContext, R.color.colorAccent)));

        ivPic3.setColorFilter(new ColorMatrixColorFilter(IconUtils.getIconColor(120, 90, 200, 255)));



    }


}